import pymongo
import os
from tools.funciton import read_xlsx_file
from config.configs import DATA_PATH, DOWNLOAD_PATH, ALPHA_DB_PORT, ALPHA_DB_HOST, DESKTOP_PATH, GOAT_ERP_HOST, \
    GOAT_ERP_PORT
korea = pymongo.MongoClient(GOAT_ERP_HOST, GOAT_ERP_PORT).goat_warehouse_korea


def check_import_fail(file_path):
    """检查导入失败原因"""
    f = read_xlsx_file(file_path, 4)
    li = []
    for i in f:
        res = korea.appointments.find_one({'appointNo': str(i)})
        if res is not None:
            li.append(i)
    print(list(set(li)))


file = os.path.join(DOWNLOAD_PATH, '副本JX3-31 - 副本.xlsx')
check_import_fail(file)